#pragma once

#define RADIATION_LIGHT_RADIUS 10.0f
#define RADIATION_GAIN_SPEED 0.03f
#define RADIATION_CURING_SPEED 0.015f
#define RADIATION_KILLING_RATIO 0.1f

#define PLAYER_WALK_SPEED 2.0f

#define STAMINA_SPEED_RATION 2.0f
#define STAMINA_MINIMAL_REQUIRED_LEVEL 0.15f
#define STAMINA_REGENERATION 0.05f

#define WEAPON_RELOADTIME 4.0f
#define WEAPON_PAUSETIME 0.2f
#define WEAPON_MAGSIZE 30

class WPlayer: public IWorldMod, public ISingleton<WPlayer>, public IKeyboardDriver
{
public:
	WPlayer();
	virtual ~WPlayer();

	/*-IWorldMod----------------------------------------------------------------*/
	void OnLevelLoad(const std::string& level);
	void OnLevelUnload();
	void OnLevelCalc();

	/*-IRender------------------------------------------------------------------*/
	void OnRender(const unsigned int i, vl::Render::LevelOfDetail quality);

	/*-IKeyboardDriver----------------------------------------------------------*/
	void OnKeyboardAction();

	/*--------------------------------------------------------------------------*/

	const glm::vec3& GetPlayerPosition() const;

	float GetPlayerRadiation() const;
	void SetPlayerRadiation(float r);

	float GetPlayerStamina() const;
	void SetPlayerStamina(float s);

	float GetPlayerHealth() const;
	void SetPlayerHealth(float h);

	float GetPlayerAmmo() const;

	void CurePlayer();

	const glm::vec3& GetTarget() const;
	void NextTarget();

protected:
	glm::vec3 m_playerPosition;

	PointLight* m_target;

private:
	float m_radiationLevel;
	PointLight* m_radiationLight;

	Sound* m_geigerSound;
	Sound* m_gunshotSound;
	Sound* m_reloadSound;
	Sound* m_gongSound;
	Sound* m_deathSound;

	void DoRadiationStuff();

	float m_staminaLevel;
	float m_playerSpeed;
	void DoStaminaStuff();

	PointLight* m_playerTorch;
	SpotLight* m_playerFlashlight;
	void DoLightStuff();

	PerspectiveCamera* m_cam3d;
	float m_cameraDistance;
	void DoCameraStuff();

	RenderableVao* m_playerModel;
	void DoMovementStuff();

	float m_healthLevel;
	void DoHealthStuff();

	float m_lastBulletShot;
	int m_bulletsLeft;
	void DoAmmoStuff();
};

namespace sh
{
void wcure();
}